package com.sve.Controller;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.ModelAttribute;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;

import com.sve.Dao.OrderRecordMapper;
import com.sve.Entity.OrderRecord;
import com.sve.Entity.Ticket;

@Controller
@RequestMapping("/OrderRecord")
public class OrderRecordController {
	private OrderRecordMapper orderrecord;

	public OrderRecordMapper getOrderrecord() {
		return orderrecord;
	}
	@Autowired
	public void setOrderrecord(OrderRecordMapper orderrecord) {
		this.orderrecord = orderrecord;
	}

	@RequestMapping("/selectOrderRecord")
	public String selectOrderRecords(Model model){
		List<OrderRecord> or =orderrecord.SOrderRecord();
		model.addAttribute("orderRecord", or);
		return "Orders";
	}
	
	@RequestMapping(value="/selectDetails" ,method = RequestMethod.POST)
	public String selectDetails(int OrderRecordId, Model model){
		OrderRecord or =orderrecord.selectByPrimaryKey(OrderRecordId);
		model.addAttribute("orderRecord", or);
		return "Details";
	}
	
	@RequestMapping("/BookingInfo")
	public String BookingInfo(Model model){
		List<OrderRecord> OrderRecord=orderrecord.SOrderRecord();
		model.addAttribute("BookingInfo",OrderRecord);
		System.out.println("用户名:"+OrderRecord.get(1).getUser().getUsername());
		System.out.println("真实密码:"+OrderRecord.get(1).getUser().getUserrealname());
		return "BookingInfo";
	}
}
